package leetcode_core.leetcode_2;

public class DoubleReverseList {
  public class ListNode {
      int val;
      ListNode next;
      ListNode pre;
      ListNode() {}
      ListNode(int val) { this.val = val; }
      ListNode(int val, ListNode next,ListNode pre) { this.val = val; this.next = next; this.pre = pre;}
  }

  public ListNode doubleReverseList(ListNode head){
      ListNode pre = null,next = null;
      while (head != null){
          next = head.next;
          head.next = pre;
          head.pre = next;
          pre = head;
          head = next;
      }
      return head;
  }



}
